/*
 * AdminOperations.java
 *
 * Created on Jan 14, 2011, 4:27:23 PM
 */
package edu.rit.varapp.graphical;

import edu.rit.varapp.datalayer.Post;
import java.awt.Dimension;

/**
 * @author Michael Klein
 * @author Eric Kisner
 */
public class AdminOperations extends AbstractView {

    private static final int VIEW_WIDTH = 281;
    private static final int VIEW_HEIGHT = 357;
    private final Post post = new Post();

    /** Creates new form AdminOperations */
    public AdminOperations() {
        super( new Dimension( VIEW_WIDTH, VIEW_HEIGHT ) );
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings( "unchecked" )
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        addNewCustomerButton = new javax.swing.JButton();
        addNewPurchaseButton = new javax.swing.JButton();
        editCustomerInfoButton = new javax.swing.JButton();
        editPurchaseInfoButton = new javax.swing.JButton();
        postNewMessageButton = new javax.swing.JButton();
        logoutButton = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Administrator Operations");
        setMinimumSize(new java.awt.Dimension(281, 357));
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });
        getContentPane().setLayout(null);

        jPanel1.setLayout(new java.awt.GridLayout(7, 1, 0, 5));

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Administrator Options");
        jPanel1.add(jLabel1);

        addNewCustomerButton.setText("Add new Customer");
        addNewCustomerButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addNewCustomerButtonActionPerformed(evt);
            }
        });
        jPanel1.add(addNewCustomerButton);

        addNewPurchaseButton.setText("Add new Purchase");
        addNewPurchaseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addNewPurchaseButtonActionPerformed(evt);
            }
        });
        jPanel1.add(addNewPurchaseButton);

        editCustomerInfoButton.setText("Edit Customer Information");
        editCustomerInfoButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editCustomerInfoButtonActionPerformed(evt);
            }
        });
        jPanel1.add(editCustomerInfoButton);

        editPurchaseInfoButton.setText("Edit Purchase Information");
        editPurchaseInfoButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editPurchaseInfoButtonActionPerformed(evt);
            }
        });
        jPanel1.add(editPurchaseInfoButton);

        postNewMessageButton.setText("Post New Message");
        postNewMessageButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                postNewMessageButtonActionPerformed(evt);
            }
        });
        jPanel1.add(postNewMessageButton);

        logoutButton.setText("Logout");
        logoutButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logoutButtonActionPerformed(evt);
            }
        });
        jPanel1.add(logoutButton);

        getContentPane().add(jPanel1);
        jPanel1.setBounds(20, 20, 230, 290);
        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void addNewCustomerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addNewCustomerButtonActionPerformed
        new AddClient().setVisible( true );
        this.dispose();
    }//GEN-LAST:event_addNewCustomerButtonActionPerformed

    private void addNewPurchaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addNewPurchaseButtonActionPerformed
        new AddPurchase().setVisible( true );
        this.dispose();
    }//GEN-LAST:event_addNewPurchaseButtonActionPerformed

    private void editCustomerInfoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editCustomerInfoButtonActionPerformed
        new AdminCustomerInfo().setVisible( true );
        this.dispose();
    }//GEN-LAST:event_editCustomerInfoButtonActionPerformed

    private void editPurchaseInfoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editPurchaseInfoButtonActionPerformed
        new AdminPurchaseInfo().setVisible( true );
        this.dispose();
    }//GEN-LAST:event_editPurchaseInfoButtonActionPerformed

    private void logoutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutButtonActionPerformed
        new LoginAdmin().setVisible( true );
        this.dispose();
    }//GEN-LAST:event_logoutButtonActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        new LoginAdmin().setVisible( true );
        this.dispose();
    }//GEN-LAST:event_formWindowClosing

    private void postNewMessageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_postNewMessageButtonActionPerformed
        this.setEnabled( false );
        new PostMessage( this, post ).setVisible( true );
    }//GEN-LAST:event_postNewMessageButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addNewCustomerButton;
    private javax.swing.JButton addNewPurchaseButton;
    private javax.swing.JButton editCustomerInfoButton;
    private javax.swing.JButton editPurchaseInfoButton;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton logoutButton;
    private javax.swing.JButton postNewMessageButton;
    // End of variables declaration//GEN-END:variables
}
